<template>
    <div class="t-tr">
        <slot></slot>
    </div>
</template>

<script>
export default {
    props: {
        fontSize: String,
        color: String,
        align: String
    },
    inject: ['table'],
    provide() {
        return {
            tr: this
        };
    },
    data() {
        return {
            isCheck: false,
            checkboxData: {
                value: 0,
                checked: false
            },
            checked: false,
            thBorder: '1',
            borderColor: '#eeeeee'
        };
    },
    created() {
        this.thBorder = this.table.border;
        this.borderColor = this.table.borderColor;
        this.table.childrens.push(this);
        this.checkboxData.value = this.table.index++;
        this.isCheck = this.table.isCheck;

    },
    methods: {
        checkboxChange(e) {
            this.checkboxData.checked = !this.checkboxData.checked;
            this.table.childrens[this.checkboxData.value] = this;
            this.table.fire(e.detail.value[0] ? true : false, this.checkboxData.value, this.table.index);
        }
    }
};
</script>

<style>
.t-tr {
    width: 100%;
    display: flex;
}

.t-tr t-th,
.t-tr t-td {
    display: flex;
    flex: 1;
}

.t-tr .t-check-box {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    color: #3b4246;
    border-left: 1px #eeeeee solid;
    border-top: 1px #eeeeee solid;
}

.t-tr .t-check-box checkbox {
    transform: scale(0.8);
}
</style>
